{include common/header}
{include common/left}
<div id="content">    
  <ul class="breadcrumb">
    <li><a href="javascript:;"><i class="icon-home"></i>添加房源</a> </li>
   </ul>
  <div class="container-fluid">
    <div class="row-fluid">
      <div class="span12">
        <div class="widget-box">
          <div class="widget-title"> 
            <h5><span class="icon"> <i class="icon-align-justify"></i> </span>添加房源</h5>
          </div>
          <div class="widget-content nopadding">
            <form action="{url('userestate/add')}" method="post" class="form-horizontal">
            {if $type==1}
              <div class="control-group">
                <label class="control-label">地址</label>
                <div class="controls">
                  <input name="address" id="address" class="tishi" type="text" value="填写楼盘名称或地段" />
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">楼层</label>
                <div class="controls">
                  <input type="text" name="floor" id="floor" class="tishi" value="填写阿拉伯数字">
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">户型</label>
                <div class="controls">
                  <select name="apartment">
                  {loop $apartment $val}
                  <option value="{$val['id']}">{$val['name']}</option>                  
                  {/loop}
                  </select>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">面积</label>
                <div class="controls">
                  <input type="text" name="area" id="area" class="tishi" value="请填写平方数">
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">装修</label>
                <div class="controls">
                  <select name="decoration">
                  {loop $decoration $val}
                  <option value="{$val['id']}">{$val['name']}</option>                   
                  {/loop}
                  </select>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">备注</label>
                <div class="controls">
                  <input type="text" name="remark" id="remark" class="tishi" value="请填写详情">
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">月租</label>
                <div class="controls">
                  <input type="text" name="rent" id="rent" class="tishi" value="请填写价格">
                </div>
              </div>
              {if $_G['member']['usergroup'] ==1}
              <div class="control-group">
                <label class="control-label">网号</label>
                <div class="controls">
                  <input type="text" name="netid">
                </div>
              </div>
              {/if}
              <input type="hidden" name="rented" value="0" >
              <!--<div class="control-group">
                <label class="control-label">租否</label>
                <div class="controls">
                  <select name="rented">                  
                  <option value="0">否</option>                  
                  <option value="1">是</option>
                  </select>
                </div>
              </div>-->
              {elseif $type==2}
              <div class="control-group">
                <label class="control-label">地址</label>
                <div class="controls">
                  <input name="address" type="text" id="address" class="tishi" value="填写楼盘名称或地段" />
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">楼层</label>
                <div class="controls">
                  <input type="text" name="floor" id="floor" class="tishi" value="填写阿拉伯数字">
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">户型</label>
                <div class="controls">
                  <select name="apartment">
                  {loop $apartment $val}
                  <option value="{$val['id']}">{$val['name']}</option>                  
                  {/loop}
                  </select>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">面积</label>
                <div class="controls">
                  <input type="text" name="area" id="area" class="tishi" value="请填写平方数">
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">权属</label>
                <div class="controls">
                  <select name="certificate">
                  {loop $certificate $val}
                  <option value="{$val['id']}">{$val['name']}</option>                   
                  {/loop}
                  </select>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">结构</label>
                <div class="controls">
                  <select name="structure">
                  {loop $structure $val}
                  <option value="{$val['id']}">{$val['name']}</option>                   
                  {/loop}
                  </select>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">装修</label>
                <div class="controls">
                  <select name="decoration">
                  {loop $decoration $val}
                  <option value="{$val['id']}">{$val['name']}</option>                   
                  {/loop}
                  </select>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">备注</label>
                <div class="controls">
                  <input type="text" name="remark" id="remark" class="tishi" value="请填写详情">
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">售价</label>
                <div class="controls">
                  <input type="text" name="rent" id="rent" class="tishi" value="请填写价格">
                </div>
              </div>
              {if $_G['member']['usergroup'] ==1}
              <div class="control-group">
                <label class="control-label">网号</label>
                <div class="controls">
                  <input type="text" name="netid">
                </div>
              </div>
              {/if}
              <input type="hidden" name="rented" value="0" >
              <!--<div class="control-group">
                <label class="control-label">售否</label>
                <div class="controls">
                  <select name="rented">                  
                  <option value="0">否</option>                  
                  <option value="1">是</option>
                  </select>
                </div>
              </div>-->
              {/if}
        
              <div class="form-actions">
              <input type="hidden" name="type" value="{$type}">
                <input type="submit" class="btn btn-primary" value="确认">
              </div>
            </form>
          </div>
        </div>
        
      </div>
    </div>
  </div>
</div>
<script>
$(function(){
$('.tishi').css('color','#ccc')
val = [];
	$('.tishi').each(function(i){
		val[i]=$('input[type=text]').eq(i).val();
		$('.tishi').eq(i).focus(function(){			
			if(val[i] == $(this).val()){
			$(this).val('');
			$(this).css('color','#333');
			}
		});
		$('.tishi').eq(i).blur(function(){		
			var index = $(this).index();
			if($(this).val()==''){
				$(this).val(val[i]);
				$(this).css('color','#ccc');
			}			
		});
    });
	
	
	/*$('.tishi').focus(function(){
		var index = $(this).index();
		if(val[index] == $(this).val()){
		$(this).val('');
		$(this).css('color','#333');
		}
	});
	$('.tishi').blur(function(){
	
		var index = $(this).index();
		if($(this).val()==''){
			$(this).val(val[index]);
			$(this).css('color','#ccc');
		}
alert($(this).index())
		
	});*/
	
});
</script>
{include common/footer}